//管理游戏配置

import { tt } from "../../ttapi_interface/ttapi.js";
import * as tt2 from "../../ttapi_layer2/ttlayer2.js";

export class WinCondition {
    //默认推掉敌方基地就行
    livetime: number;//
    killcount: number;//
}
export class PlayerInfo {
    cardlimit: boolean;
    cards: string[];
}
export class CardInfo {
    time: number;
    card: string;
}
export class EnemyInfo {
    mode: string;
    cards: CardInfo[];

}
export type RoadPoint = number[]
export type RoadInfo = RoadPoint[];
export class BattleGroundInfo {
    tex: string;
    height: number;
    playerbase: RoadPoint;
    enemybase: RoadPoint;
    roads: RoadInfo[];
}
export class GameConfig {

    constructor() {

    }


    async LoadAsync(jsonurl: string): Promise<void> {
        let txt = await tt.loader.LoadStringAsync(tt2.QFrame_ResMgr.GetDefResPath() + jsonurl);
        let json = JSON.parse(txt) as any;
        this.story = json.story;//是否有前置剧情
        this.wincond = json.wincond;//胜利条件配置
        this.battleground = json.battleground;//战场配置
        this.player = json.player;//玩家配置
        this.enemy = json.enemy;//敌方配置

    }

    story: string;
    battleground: BattleGroundInfo;
    wincond: WinCondition;
    player: PlayerInfo;
    enemy: EnemyInfo;
}